<script setup>
//1、定义属性：只读
let props = defineProps(['money',"books"])


//2、使用emit: 定义事件
let emits = defineEmits(['buy'])
function buy(){
  emits('buy', -5)
}
</script>

<template>
<div style="background-color: #646cff">
  <h5>Son</h5>
  <div>账户：{{props.money}}</div>
  <li v-for="(b,i) in props.books">{{b}}</li>
  <button @click="buy">买棒棒糖</button>
</div>
</template>

<style scoped>

</style>